Full source code website bán hàng thương mại điện tử gần giống shopee
468.847 lượt xem;
1 <?
2 echo $_SESSION["session_message"];
3 $_SESSION["session_message"] = "";
4 $MAXPAGE=20;
5 ?>
6 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
7 <tr align=center>
8 <td class="title" width="100%">Option : <a href="./?act=option_m&page=<? echo $page?>&cat=<? echo $_REQUEST['cat']; ?>"><font class="V10pt" color="#ffffff">Nhập Mới</font></a>
9 </td>
10 </tr>
11 </table>
12 <?
13 switch ($_GET['action'])
14 {
15 case 'del' :
16 $id = $_GET['id'];
17 $pro=GetOptionInfo($id);
18 if ($pro)
19 {
20 $sql = "delete from option_home where id='".$id."'";
21 $result = mysql_query($sql,$con);
22 if ($result)
23 {
24
25 echo "<p align=center class='err'>Đã xóa thành công</p>";
26 }
27 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
28 }
29 break;
30 }
31 ?>
32
33 <?
34 if (isset($_POST['ButDel'])) {
35 $cnt=0;
36 foreach ($_POST['chk'] as $id)
37 {
38 $pro=GetOptionInfo($id);
39 if ($pro)
40 {
41 @$result = mysql_query("delete from option_home where id='".$id."'",$con);
42 if ($result) {
43 $cnt++;
44
45 }
46 }
47 }
48 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
49 }
50
51
52
53
54
55 ?>
56
57 <?
58 $page = $_GET["page"];
59 $p=0;
60 if ($page!='') $p=$page;
61 $where="1=1";
62 //if ($_REQUEST['status']!='') $where="products_status=".$_REQUEST['status']." ";
63 if ($_REQUEST['cat']!='') $where="cat_id=".$_REQUEST['cat'];
64 ?>
65 <form method="POST" name="frmList" action="index.php">
66 <input type=hidden name="page" value="<? echo $page; ?>">
67 <?
68 function taotrang($total,$link,$nitem,$itemcurrent,$step=10)
69 { global $con;
70 $ret="";
71
72 $param="";
73 $pages=count_page($total,$nitem);
74 if ($itemcurrent>0) $ret.='<a title="Đầu tiên" href="'.$link.'0" class="lslink">[<]</a> ';
75 if ($itemcurrent>1) $ret.='<a title="Về trước" href="'.$link.($itemcurrent-1).'" class="lslink">[<<]</a> ';
76 $from=($itemcurrent-$step>0?$itemcurrent-$step:0);
77 $to=($itemcurrent+$step<$pages?$itemcurrent+$step:$pages);
78 for ($i=$from;$i<$to;$i++)
79 {
80 if ($i!=$itemcurrent) $ret.='<a href="'.$link.$i.'" class="lslink">'.($i+1).'</a> ';
81 else $ret.='<b>'.($i+1).'</b> ';
82 }
83 if (($itemcurrent<$pages-2) && ($pages>1)) $ret.='<a title="Tiếp theo" href="'.$link.($itemcurrent+1).'">[>>]</a> ';
84 if ($itemcurrent<$pages-1) $ret.='<a title="Cuối cùng" href="'.$link.($pages-1).'">[>]</a>';
85 return $ret;
86 }
87
88 $pageindex=taotrang(CountRecord("option_home",$where),"./?act=option&cat=".$_REQUEST['cat']."&page=",$MAXPAGE,$page);
89 ?>
90
91 <table cellspacing="0" cellpadding="0" width="100%">
92 <? if ($_REQUEST['code']==1) echo '<tr><td colspan="2" align="center" class="err">Đã cập nhật thành công</td></tr>'; ?>
93 <tr>
94 <td class="smallfont">Trang : <? echo $pageindex; ?></td>
95 <td height="30" align="right" class="smallfont">
96 <select size="1" name="ddCat" class="smallfont">
97 <?
98 $ms=GetListCat(17);
99 echo '<option value="">[Tất cả]</option>';
100 foreach ($ms as $m)
101 if ($m[0]!=$_REQUEST['cat'])
102 echo '<option value="'.$m[0].'">'.$m[1].'</option>';
103 else
104 echo '<option selected value="'.$m[0].'">'.$m[1].'</option>';
105 ?>
106 </select>
107 <input type="button" value="Chuyển" class="button" onclick="window.location='./?act=option&cat='+ddCat.value">
108 </td>
109 </tr>
110 </table>
111 <!-- end tim kiem -->
112 </td>
113 </tr>
114 </table>
115
116 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
117 <tr>
118 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
119 <td colspan="2" nowrap class="title"> </td>
120 <td align="center" nowrap class="title"><b>ID</b></td>
121 <td align="center" nowrap class="title"><b>Thứ tự</b></td>
122 <td align="center" nowrap class="title"><b>Tên </b></td>
123 <td align="center" nowrap class="title"><b>Thông số sau</b></td>
124 <td align="center" nowrap class="title"><b>Danh mục</b></td>
125 <td align="center" nowrap class="title"><b>Kiểu</b></td>
126
127 </tr>
128
129 <?php
130 $sql="select * from option_home where $where order by id limit ".($p*$MAXPAGE).",".$MAXPAGE;
131 $result=mysql_query($sql,$con);
132 $i=0;
133 while(($row=mysql_fetch_array($result)))
134 {
135 $i++;
136 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
137 $cat_system=GetCatInfo($row['cat_id']);
138 ?>
139
140 <tr>
141 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
142 <input type="checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
143 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
144 <a href="./?act=option_m&cat=<? echo $_REQUEST['cat']; ?>&status=<? echo $_REQUEST['status']; ?>&id=<? echo $row['id']; ?>&page=<? echo $page?>">Sửa</a></td>
145 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
146 <a onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" href="./?act=option&action=del&cat=<? echo $_REQUEST['cat']; ?>&status=<? echo $_REQUEST['status']; ?>&id=<? echo $row['id']; ?>">Xoá</a></td>
147 <td bgcolor="<? echo $color; ?>" align="left" align="left" class="smallfont"><? echo $row['id']; ?> </td>
148 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['thutu']; ?> </td>
149 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['name']; ?> </td>
150 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['doituong']; ?> </td>
151 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $cat_system['name']; ?> </td>
152 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['option_home']; ?> </td>
153
154 </tr>
155 <?
156 }
157 ?>
158 </table>
159 <input type="hidden" name="act" value="option"><table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
160 <tr>
161 <td>
162 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button"></td>
163 </tr>
164 </table>
165 </form>
166 <script language="JavaScript">
167 function chkallClick(o) {
168 var form = document.frmList;
169 for (var i = 0; i < form.elements.length; i++) {
170 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
171 form.elements[i].checked = document.frmList.chkall.checked;
172 }
173 }
174 }
175 </script>
2 echo $_SESSION["session_message"];
3 $_SESSION["session_message"] = "";
4 $MAXPAGE=20;
5 ?>
6 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
7 <tr align=center>
8 <td class="title" width="100%">Option : <a href="./?act=option_m&page=<? echo $page?>&cat=<? echo $_REQUEST['cat']; ?>"><font class="V10pt" color="#ffffff">Nhập Mới</font></a>
9 </td>
10 </tr>
11 </table>
12 <?
13 switch ($_GET['action'])
14 {
15 case 'del' :
16 $id = $_GET['id'];
17 $pro=GetOptionInfo($id);
18 if ($pro)
19 {
20 $sql = "delete from option_home where id='".$id."'";
21 $result = mysql_query($sql,$con);
22 if ($result)
23 {
24
25 echo "<p align=center class='err'>Đã xóa thành công</p>";
26 }
27 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
28 }
29 break;
30 }
31 ?>
32
33 <?
34 if (isset($_POST['ButDel'])) {
35 $cnt=0;
36 foreach ($_POST['chk'] as $id)
37 {
38 $pro=GetOptionInfo($id);
39 if ($pro)
40 {
41 @$result = mysql_query("delete from option_home where id='".$id."'",$con);
42 if ($result) {
43 $cnt++;
44
45 }
46 }
47 }
48 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
49 }
50
51
52
53
54
55 ?>
56
57 <?
58 $page = $_GET["page"];
59 $p=0;
60 if ($page!='') $p=$page;
61 $where="1=1";
62 //if ($_REQUEST['status']!='') $where="products_status=".$_REQUEST['status']." ";
63 if ($_REQUEST['cat']!='') $where="cat_id=".$_REQUEST['cat'];
64 ?>
65 <form method="POST" name="frmList" action="index.php">
66 <input type=hidden name="page" value="<? echo $page; ?>">
67 <?
68 function taotrang($total,$link,$nitem,$itemcurrent,$step=10)
69 { global $con;
70 $ret="";
71
72 $param="";
73 $pages=count_page($total,$nitem);
74 if ($itemcurrent>0) $ret.='<a title="Đầu tiên" href="'.$link.'0" class="lslink">[<]</a> ';
75 if ($itemcurrent>1) $ret.='<a title="Về trước" href="'.$link.($itemcurrent-1).'" class="lslink">[<<]</a> ';
76 $from=($itemcurrent-$step>0?$itemcurrent-$step:0);
77 $to=($itemcurrent+$step<$pages?$itemcurrent+$step:$pages);
78 for ($i=$from;$i<$to;$i++)
79 {
80 if ($i!=$itemcurrent) $ret.='<a href="'.$link.$i.'" class="lslink">'.($i+1).'</a> ';
81 else $ret.='<b>'.($i+1).'</b> ';
82 }
83 if (($itemcurrent<$pages-2) && ($pages>1)) $ret.='<a title="Tiếp theo" href="'.$link.($itemcurrent+1).'">[>>]</a> ';
84 if ($itemcurrent<$pages-1) $ret.='<a title="Cuối cùng" href="'.$link.($pages-1).'">[>]</a>';
85 return $ret;
86 }
87
88 $pageindex=taotrang(CountRecord("option_home",$where),"./?act=option&cat=".$_REQUEST['cat']."&page=",$MAXPAGE,$page);
89 ?>
90
91 <table cellspacing="0" cellpadding="0" width="100%">
92 <? if ($_REQUEST['code']==1) echo '<tr><td colspan="2" align="center" class="err">Đã cập nhật thành công</td></tr>'; ?>
93 <tr>
94 <td class="smallfont">Trang : <? echo $pageindex; ?></td>
95 <td height="30" align="right" class="smallfont">
96 <select size="1" name="ddCat" class="smallfont">
97 <?
98 $ms=GetListCat(17);
99 echo '<option value="">[Tất cả]</option>';
100 foreach ($ms as $m)
101 if ($m[0]!=$_REQUEST['cat'])
102 echo '<option value="'.$m[0].'">'.$m[1].'</option>';
103 else
104 echo '<option selected value="'.$m[0].'">'.$m[1].'</option>';
105 ?>
106 </select>
107 <input type="button" value="Chuyển" class="button" onclick="window.location='./?act=option&cat='+ddCat.value">
108 </td>
109 </tr>
110 </table>
111 <!-- end tim kiem -->
112 </td>
113 </tr>
114 </table>
115
116 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
117 <tr>
118 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
119 <td colspan="2" nowrap class="title"> </td>
120 <td align="center" nowrap class="title"><b>ID</b></td>
121 <td align="center" nowrap class="title"><b>Thứ tự</b></td>
122 <td align="center" nowrap class="title"><b>Tên </b></td>
123 <td align="center" nowrap class="title"><b>Thông số sau</b></td>
124 <td align="center" nowrap class="title"><b>Danh mục</b></td>
125 <td align="center" nowrap class="title"><b>Kiểu</b></td>
126
127 </tr>
128
129 <?php
130 $sql="select * from option_home where $where order by id limit ".($p*$MAXPAGE).",".$MAXPAGE;
131 $result=mysql_query($sql,$con);
132 $i=0;
133 while(($row=mysql_fetch_array($result)))
134 {
135 $i++;
136 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
137 $cat_system=GetCatInfo($row['cat_id']);
138 ?>
139
140 <tr>
141 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
142 <input type="checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
143 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
144 <a href="./?act=option_m&cat=<? echo $_REQUEST['cat']; ?>&status=<? echo $_REQUEST['status']; ?>&id=<? echo $row['id']; ?>&page=<? echo $page?>">Sửa</a></td>
145 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
146 <a onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" href="./?act=option&action=del&cat=<? echo $_REQUEST['cat']; ?>&status=<? echo $_REQUEST['status']; ?>&id=<? echo $row['id']; ?>">Xoá</a></td>
147 <td bgcolor="<? echo $color; ?>" align="left" align="left" class="smallfont"><? echo $row['id']; ?> </td>
148 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['thutu']; ?> </td>
149 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['name']; ?> </td>
150 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['doituong']; ?> </td>
151 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $cat_system['name']; ?> </td>
152 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['option_home']; ?> </td>
153
154 </tr>
155 <?
156 }
157 ?>
158 </table>
159 <input type="hidden" name="act" value="option"><table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
160 <tr>
161 <td>
162 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button"></td>
163 </tr>
164 </table>
165 </form>
166 <script language="JavaScript">
167 function chkallClick(o) {
168 var form = document.frmList;
169 for (var i = 0; i < form.elements.length; i++) {
170 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
171 form.elements[i].checked = document.frmList.chkall.checked;
172 }
173 }
174 }
175 </script>